package com.korustar.autumnal.reflect;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ClassLoaderUtil {
	private static final Logger LOGGER = LoggerFactory.getLogger( ClassLoaderUtil.class );
	
	public static Class<?> getClassFromClasspath(String beanClassName) {
		
		try {
			ClassLoader classLoader = ClassLoaderUtil.class.getClassLoader();
			Class<?> cls = classLoader.loadClass(beanClassName);
			return cls;
		} catch (ClassNotFoundException e) {
			LOGGER.warn("Class '"+beanClassName+"' not on classpath",e);
			return null;
		} catch (NullPointerException e) {
			LOGGER.warn("Attempted to find class without giving a name",e);
			return null;
		}
	}
	
}
